Skip to content

Conversation

@Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Feb 21, 2025

Description

Fixes #7284
Adds a filter rocket_preload_fonts_processed_extensions to customize extension of fonts sent to the beacon script.

Example of usage:

apply_filters( 'rocket_preload_fonts_processed_extensions', function () {
	return [
		'woff2',
		'woff',
	];
});

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

What was tested

Integration tests are making sure that processed_extensions is added to the JS variable used by the beacon (rocket_beacon_data).

How to test

Just open a page that would include the beacon, and make sure that processed_extensions is added to the JS variable used by the beacon (rocket_beacon_data).
Also, you can change its value by using the filter rocket_preload_fonts_processed_extensions, example of usage:

apply_filters('rocket_preload_fonts_processed_extensions', function () {
return ['woff2', 'ttf'];
});

Technical description

Documentation

This pull request includes changes to the handling of font extensions in the rocket_beacon_data object and the addition of a filter for processed font extensions. The most important changes are the introduction of a new array for processed font extensions and the updates to various HTML fixture files to include this new data.

Enhancements to font extension processing:

Updates to HTML fixture files:

New dependencies

None

Risks

None

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld self-assigned this Feb 21, 2025
@Miraeld Miraeld requested a review from a team February 21, 2025 04:05
@Miraeld Miraeld linked an issue Feb 21, 2025 that may be closed by this pull request
@codacy-production
Copy link

codacy-production bot commented Feb 21, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -0.10%) 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2ffbe14) 39700 17388 43.80%
Head commit (f4307b0) 39711 (+11) 17394 (+6) 43.80% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7318) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Base automatically changed from feature/preload-fonts to feature/3.19 February 24, 2025 13:45
Copy link
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter is not working now because of the mentioned line.

@Miraeld Miraeld requested a review from wordpressfan February 28, 2025 00:53
Copy link
Contributor

@remyperona remyperona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little improvement

@Miraeld Miraeld requested a review from remyperona May 5, 2025 14:11
@Mai-Saad
Copy link
Contributor

Mai-Saad commented May 8, 2025

@Miraeld Thanks for the PR.

@Miraeld
Copy link
Contributor Author

Miraeld commented May 13, 2025

All test following testrail are green :)
testrail-report-718.pdf

@Miraeld Miraeld merged commit fbab0a7 into feature/3.19 May 15, 2025
12 checks passed
@Miraeld Miraeld deleted the enhancement/7284-add-filter-to-add-extension branch May 15, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.19 - Preload Fonts - Filter to add extensions

6 participants